<style type="text/css">   
     .toolbar {
        /*float: right;*/
        padding-top: 12px;
        padding-left: 20px;
        padding-bottom: 12px;
        }
        
     .form-horizontal .control-group {
    margin-bottom: 10px;
    }
</style>
<div class="row-fluid">
<div class="span">
<div class="box">
<div class="title">
<h4><span class="icon16 cc-icon-list-4"></span> <span>{$title }</span>
</h4>
<a href="#" class="minimize" style="display: none;">Minimize</a></div>
<div class="content noPad clearfix">
<form id="fm_module_remove" class="form-horizontal form-inline" action="__APP__/System/modules_remove" method="post">         
<div class='toolbar'>
    <span>
    <a id='btnnew' class="btn btn-small " data-toggle="modal" href="#mod_module_add" data-keyboard="false" data-backdrop="false">
      <i class="icon-plus"></i> 新增模块 </a>
    <a id='btn_edit' class="btn btn-small " data-toggle="modal" href="#" >
      <i class="cc-icon-pencil-4"></i> 修改模块 </a>  
    <button type="submit" id="btndel" class="btn btn-small btn-danger"><i class="icon-trash icon-white"></i> 删除模块</button>
    </span>
</div>

<table id="client_data" cellpadding="0" cellspacing="0" border="0" class="dynamicTable display table table-bordered">
        <thead>
            <tr>

                <th style="width:12px;" id="cbx"><input type="checkbox" id="checkall" onclick="selAll()" /></th>
                <th style="width:15%;">功能名称</th>
                <th style="width:25%;">功能说明</th>
                <th style="width:80px;">分类</th>
                <th style="width:80px;">模块名称</th>
                <th style="width:100px;">默认操作</th>
                <th style="width:120px;">功能图片</th>
                <th style="width:30px;">显示</th>

            </tr>
        </thead>
        <tbody>
             <iterate name="data" id="item" key="k">
                 <if condition="($item['p_name'] eq '')">
                    <tr style="background-color:#E8EAEB">
                 <else/>
                    <tr>
                 </if>

                <td id="cbx"><input type="checkbox" id="ids[]" name="ids[]" value="{$item['Id']}" class="nostyle"/></td>              

                <td>{$item['MenuName']}</td>
                <td style="text-align: left;"><php>echo nl2br($item['MenuDesc']);</php></td>
             <td>{$item['p_name']}</td>
                <td>{$item['Module']}</td>
                <td>{$item['Action']}</td>
                <td>{$item['Image']}</td>
                <td>
                    <if condition="($item['View'] eq 1)">
                       <span class="icon12 blue cc-icon-checkmark"></span>
                    </if>
                    <if condition="($item['View'] eq 0)">
                       <span class="icon12 red cc-icon-cancel"></span>
                    </if>
                 </td>
             </tr>
             <!--
             <if condition="($item['p_id'] neq  $data[$k]['p_id'])">
                 <tr>
                     <td colspan="8" style="height:5px"></td>
                 </tr>
             </if>-->
            </iterate>
        </tbody>
    </table>
</form>

</div>
</div>
    
<form id="fm_module_add" class="form-horizontal form-inline" action="__APP__/System/modules_add" method="post">    
<div class="modal hide" id="mod_module_add">
  <div class="modal-header">
    <a class="close" data-dismiss="modal">×</a>
    <h4>
        <span>新增模块</span></h4>
  </div>
  <div class="modal-body">

        
        <fieldset>
            <div class="control-group">
                <label class="control-label" for="">功能名称</label>
                <div class="controls">
                    <input type="text" id="MenuName" name="MenuName" style="width:120px;" value=""/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="">功能说明</label>
                <div class="controls">
                    <textarea align="left"  rows="4" cols="40" id="MenuDesc" name="MenuDesc" style="width:300px"></textarea>
                  
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="">所属版块</label>
                <div class="controls">
                  <tagLib name="html" /> 
		  <html:select id="Pid" name="Pid" first="请选择" options="parent_id" /> 
                </div>
            </div>
            
            <div class="control-group">
                <label class="control-label" for="">模块名称</label>
                <div class="controls">
                  
                  <input type="text" id="Module" name="Module" style="width:120px;" value=""/>
                </div>
            </div>     
            <div class="control-group">
                <label class="control-label" for="">默认操作</label>
                <div class="controls">
                    <input type="text" id="Action" name="Action" style="width:120px;" value=""/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="">功能图片</label>
                <div class="controls">
                    <input type="text" id="Image" name="Image" style="width:120px;" value=""/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="">是否显示</label>
                <div class="controls">
                        <input id="View" name="View" type="checkbox" checked="checked" >
                </div>
            </div>
        </fieldset>

  </div>
  <div class="modal-footer">
    <button type="submit" class="btn btn-small btn-primary" id="loginBtn"><span class="cc-icon-checkmark-3 white"></span> 确定</button>
    <a href="#" class="btn btn-small btn-danger" data-dismiss="modal"><span class="cc-icon-cancel-4 white"></span>关闭</a>
 </div>
</div>
</form>    

<script type="text/javascript">
     $(function(){
         //$("input, textarea, select").not(".nostyle").uniform();
         //$('.normal-toggle-button').toggleButtons();
         
         $('#checkall').click(function(){ //alert(this.checked)
            $('input[type="checkbox"]').attr("checked",this.checked); 
        });
        
        $("#btndel").click(function(){
           return window.confirm("确认要批量删除吗?");
        });
        
        $("#btn_edit").click(function(){ 
           var s = $("table input:checked").first();
           
           if ($(s).val() == undefined){
               alert('请选择要修改的模块!');
               return false;
           }

           window.location.href="__URL__/modules_edit?module_id="+encodeURI($(s).val());  
        });
         
         $("#fm_module_add").validate({
            rules: {
                    MenuName : "required",
                    Module : "required",
                    Action :  "required",
                    Image :  "required"
            },
            messages: {
                    MenuName : "请输入功能名称!",
                    Module :"请输入模块名称!",
                    Action :"请输入操作名称!",
                    Image :"请输入显示图片!"

            }
        });
        
        $('#mod_module_add').on('show', function () {
            // do something…
            document.getElementById("fm_module_add").reset();
        })
     });
     
</script>
        